#ifndef TOMATOCLOCK_H
#define TOMATOCLOCK_H

#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QTimer>
#include <QTime>
#include <QRadioButton>
#include <QButtonGroup>

class TomatoClock : public QWidget {
    Q_OBJECT

public:
    // explicit TomatoClock(int workDuration,int breakDuration, QWidget *parent = nullptr);
    explicit TomatoClock(int workDuration, QWidget *parent = nullptr);

    void start();
    void pause();
    void reset();
    void togglePause();

private slots:
    void updateTime();
    
signals:
    void timeUpdated(QString textStr);
    void updateDashBoardTime();

private:
    QLabel *timeLabel;
    QPushButton *startButton;
    QPushButton *pauseButton;
    QPushButton *resetButton;
    QTime time;
    int workDuration;
    // int breakDuration;
    int duration;
    int elapsedTime;
    bool isPaused;
    bool isWorking;
    QTimer *timer;  // 定义 QTimer 对象

    void initUI();
    void initTimer();
    void resetTimer();
};

#endif // TOMATOCLOCK_H